home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Amiga Classic Collection
/
The Amiga Classic Collection - Disc 1.iso
/
Education
/
ED16-CrosswordCreator.DMS
/
ED16-CrosswordCreator.adf
/
Source
/
CPCRequesters.mod
< prev
next >
Wrap
Text File
|
1991-07-13
|
3KB
|
125 lines
IMPLEMENTATION MODULE CPCRequesters;
IMPORT Conversions;
IMPORT CPCGlobal;
IMPORT Requester;
IMPORT RequesterSet;
IMPORT String;
IMPORT SYSTEM;
PROCEDURE InputLine(VAR a: ARRAY OF CHAR; txt,ref: ARRAY OF CHAR;
length: INTEGER);
VAR
message: ARRAY[0..0] OF Requester.Text;
res,flag: BOOLEAN;
i: INTEGER;
l: INTEGER;
x: ARRAY[0..256] OF CHAR;
BEGIN
FOR i:=0 TO 256 DO
x[i]:="\o";
END;
String.Copy(message[0],txt);
String.Copy(x,a);
REPEAT
Requester.SetReqBorderPen(1);
Requester.SetReqTextPen(0);
res:=RequesterSet.StringRequest(CPCGlobal.window,50,50,540,55,
message,x,SYSTEM.ADR(CPCGlobal.msg[72]),
SYSTEM.ADR(CPCGlobal.msg[73]),
Requester.ReqFlagSet{Requester.reqBorder,Requester.reqShadow},
FALSE);
flag:=FALSE;
IF String.Length(x)=0 THEN
res:=FALSE;
END;
IF res THEN
FOR i:=0 TO String.Length(x)-1 DO
flag:=flag OR (String.FirstPos(ref,0,x[i])=String.noOccur);
END;
END;
IF flag THEN
String.Copy(message[0],CPCGlobal.msg[78]);
END;
l:=String.Length(x);
IF l>length THEN
String.Copy(message[0],CPCGlobal.msg[80]);
flag:=TRUE;
END;
UNTIL NOT flag;
IF NOT res THEN
x[0]:="\o";
END;
String.Copy(a,x);
END InputLine;
PROCEDURE InputNum(txt: ARRAY OF CHAR; low,high,def: INTEGER; odd: BOOLEAN): INTEGER;
VAR
err,sgn: BOOLEAN;
numstr: ARRAY[0..20] OF CHAR;
val: INTEGER;
tmpval: LONGINT;
BEGIN
Conversions.ValToStr(def,FALSE,numstr,10,0,"0",err);
IF err THEN
RETURN -1;
END;
REPEAT
InputLine(numstr,txt,"0123456789",10);
IF String.Length(numstr)=0 THEN
RETURN -1;
END;
sgn:=FALSE;
Conversions.StrToVal(numstr,tmpval,sgn,10,err);
val:=tmpval;
IF err THEN
RETURN -1;
END;
UNTIL ((NOT odd) OR ODD(val)) AND (val>=low) AND (val<=high);
RETURN val;
END InputNum;
PROCEDURE YesOrNo(txt: ARRAY OF CHAR): BOOLEAN;
VAR
t: ARRAY[0..0] OF Requester.Text;
res: BOOLEAN;
BEGIN
String.Copy(t[0],txt);
Requester.SetReqBorderPen(1);
Requester.SetReqTextPen(0);
res:=RequesterSet.BooleanRequest(CPCGlobal.window,50,50,540,55,t,
SYSTEM.ADR(CPCGlobal.msg[74]),
SYSTEM.ADR(CPCGlobal.msg[75]),"\o","\o",
Requester.ReqFlagSet{Requester.reqBorder,Requester.reqShadow});
RETURN res;
END YesOrNo;
PROCEDURE HoriOrVert(txt: ARRAY OF CHAR): BOOLEAN;
VAR
t: ARRAY[0..0] OF Requester.Text;
res: BOOLEAN;
BEGIN
String.Copy(t[0],txt);
Requester.SetReqBorderPen(1);
Requester.SetReqTextPen(0);
res:=RequesterSet.BooleanRequest(CPCGlobal.window,50,50,540,55,t,
SYSTEM.ADR(CPCGlobal.msg[76]),
SYSTEM.ADR(CPCGlobal.msg[77]),"\o","\o",
Requester.ReqFlagSet{Requester.reqBorder,Requester.reqShadow});
RETURN res;
END HoriOrVert;
END CPCRequesters.